package com.example.consumer.controller;

import com.example.consumer.entity.UserEntity;
import com.example.consumer.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @PostMapping("/save")
    public Object save(UserEntity entity) {
        int insert = userMapper.insert(entity);
        return insert;
    }
    @GetMapping("/queryUser")
    public UserEntity queryUser(String userName) {
        UserEntity userEntity = userMapper.selectUser(userName);
        return userEntity;
    }
}
